/**
** \file       ast_printer.h
**
** \brief      declaration of the printer functions
**
** \authors    Ben M'rad Hanna, Boillot Ulysse, De Oliveira Guillaume,
**             Laterem Hamza and Nguyen Viet Dung
**
** \version    0.8
**
** \date       26 November 2010
**
*/

#ifndef AST_PRINTER_H_
# define AST_PRINTER_H_

# include <unistd.h>
# include <stdlib.h>
# include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
# include "ast.h"

/**
** \fn         print_int
**
** \brief      Prints an int in fd
**
** \param      int      n
**	       int      fd
**
** \return     Returns nothing
**
*/

void	print_int(int			n,
		  int			fd);

/**
** \fn         print_ast
**
** \brief      Prints the node s_ast
**
** \param      s_ast                 *ast
**
** \return     Returns nothing
**
*/

void	print_ast(s_ast			*ast);

/**
** \fn         print_list
**
** \brief      Prints the node s_list
**
** \param	s_list		*list
**		int		i
**		int		fd
**
** \return     Returns nothing
**
*/

void	print_list(s_list		*list,
		   int			i,
		   int			fd);

/**
** \fn         print_andor
**
** \brief      Prints the node s_andor
**
** \param      s_andor             *node
**             int                 fd
**             int                 last
**
** \return     Returns the number of the last node
**
*/

int	print_andor(s_andor		*node,
		    int			fd,
		    int			last);

/**
** \fn         print_pipeline
**
** \brief      Prints the node s_pipeline
**
** \return     Returns the number of the last node
**
*/

int	print_pipeline(s_pipeline	*node,
		       int		i,
		       int		fd,
		       int		last);

/**
** \fn         print_cmd
**
** \brief      Prints the node s_command
**
** \return     Returns the number of the last node
**
*/

int	print_cmd(s_command		*node,
		  int			i,
		  int			fd,
		  int			last);

/**
** \fn         print_smp_cmd
**
** \brief      Prints the node s_smp_cmd
**
** \return     Returns the number of the last node
**
*/

int	print_smp_cmd(s_smp_cmd		*node,
		      int		i,
		      int		fd);

/**
** \fn         print_sh_cmd
**
** \brief      Prints the node s_sh_cmd
**
** \return     Returns the number of the last node
**
*/

int	print_sh_cmd(s_sh_cmd		*node,
		     int		i,
		     int		fd,
		     int		last);

/**
** \fn         print_prefix
**
** \brief      Prints the node s_prefix
**
** \return     Returns the number of the last node
**
*/

int	print_prefix(s_prefix		*node,
		     int		i,
		     int		fd);

/**
** \fn         print_element
**
** \brief      Prints the node s_element
**
** \return     Returns the number of the last node
**
*/

int	print_element(s_element		*node,
		      int		i,
		      int		fd);

/**
** \fn         print_rulefor
**
** \brief      Prints the node s_rulefor
**
** \return     Returns the number of the last node
**
*/

int	print_rulefor(s_rulefor		*node,
		      int		i,
		      int		fd,
		      int		last);

/**
** \fn         print_ruleif
**
** \brief      Prints the node s_ruleif
**
** \return     Returns the number of the last node
**
*/

int	print_ruleif(s_ruleif		*node,
		     int		i,
		     int		fd,
		     int		last);

/**
** \fn         print_ruleuntil
**
** \brief      Prints the node s_ruleuntil
**
** \return     Returns the number of the last node
**
*/

int	print_ruleuntil(s_ruleuntil	*node,
			int		last,
			int		fd);

/**
** \fn         print_rulecase
**
** \brief      Prints the node s_rulecase
**
** \return     Returns the number of the last node
**
*/

int	print_rulecase(s_rulecase	*node,
		       int		last,
		       int		fd);

/**
** \fn         print_caseitem
**
** \brief      Prints the node s_caseitem
**
** \return     Returns the number of the last node
**
*/

int	print_caseitem(s_caseitem	*node,
		       int		i,
		       int		fd);

/**
** \fn         print_rulewhile
**
** \brief      Prints the node s_rulewhile
**
** \return     Returns the number of the last node
**
*/

int	print_rulewhile(s_rulewhile	*node,
			int		i,
			int		fd,
			int		last);

/**
** \fn         print_cmpdlist
**
** \brief      Prints the node s_cmpdlist
**
** \return     Returns the number of the last node
**
*/

int	print_cmpdlist(s_cmpdlist	*node,
		       int		i,
		       int		fd,
		       int		last);

/**
** \fn         print_funcdec
**
** \brief      Prints the node s_funcdec
**
** \return     Returns the number of the last node
**
*/

int	print_funcdec(s_funcdec		*node,
		      int		i,
		      int		fd,
		      int		last);

/**
** \fn         print_word
**
** \brief      Prints the node s_word
**
** \return     Returns nothing
**
*/

void	print_word(s_word		*node,
		   int			i,
		   int			fd);

/**
** \fn         print_redir
**
** \brief      Prints the node s_redir
**
** \return     Returns the number of the last node
**
*/

int	print_redir(s_redir		*node,
		    int			i,
		    int			fd);

/**
** \fn         print_dogroup
**
** \brief      Prints the node s_dogroup
**
** \return     Returns nothing
**
*/

int	print_dogroup(s_dogroup		*node,
		      int		i,
		      int		fd,
		      int		last);

/**
** \fn         print_caseclause
**
** \brief      Prints the node s_caseclause
**
** \return     Returns the number of the last node
**
*/

int	print_caseclause(s_caseclause	*node,
			 int		i,
			 int		fd);

/**
** \fn         print_else_clause
**
** \brief      Prints the node s_else_clause
**
** \return     Returns the number of the last node
**
*/

int	print_else_clause(s_else_clause	*node,
			  int		last,
			  int		fd);

#endif /* !AST_PRINTER_H_*/
